<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use app\modules\Cruise\models\Cruise;
use app\modules\Product\models\Product;

//$all = Cruise::find()->where(['status'=>1])->all(); 
//$cruise = yii\helpers\ArrayHelper::map($all, 'id', 'name');

// 获取所有船期的游轮
$all = Product::find()->where(['status'=>1])->all(); 
$cruise = [];

foreach($all as $product){
	$cruise[$product->cruise_id] = $product->cruise->name; 
}
?>

<div class="product-search">

    <?php $form = ActiveForm::begin([
        'action' => ['list'],
        'method' => 'get',
        'layout' => 'inline',
        'options' => ['data-pjax'=>true],
    ]); ?>

    <?php  echo $form->field($model, 'cruise_id')->dropdownList($cruise, ['prompt'=>'选择邮轮']) ?>

    <?= $form->field($model, 'code')->textInput(['placeholder' => '团号']) ?>

    <?= $form->field($model, 'name')->textInput(['placeholder' => '团队名称']) ?>

    <?= $form->field($model, 'go_time')->textInput(['placeholder' => '出发时间']) ?>

    <?php  echo $form->field($model, 'type')->dropdownList(Yii::$app->params['product_type'], ['prompt'=>Yii::t('app.cruise','Type')]) ?>

    <?php  echo $form->field($model, 'status')->dropdownList(Yii::$app->params['status'], ['prompt'=>Yii::t('app','Status')]) ?>

    <?php // echo $form->field($model, 'day') ?>

    <?php // echo $form->field($model, 'from_city') ?>

    <?php // echo $form->field($model, 'to_city') ?>

    <?php // echo $form->field($model, 'line') ?>

    <?php // echo $form->field($model, 'cost') ?>

    <?php // echo $form->field($model, 'visa') ?>

    <?php // echo $form->field($model, 'status') ?>

    <?php // echo $form->field($model, 'user_id') ?>

    <?php // echo $form->field($model, 'created_at') ?>

    <?php // echo $form->field($model, 'updated_at') ?>

    <div class="form-group">
        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
